package com.cardone.platform.configuration.service;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;


import lombok.Getter;


import lombok.Setter;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.transaction.annotation.Transactional;

import com.cardone.common.dto.PaginationDto;
import com.cardone.common.cache.Caches;
import com.cardone.context.Attributes;
import com.cardone.context.ContextHolder;
import com.cardone.common.util.EntityUtils;
import com.cardone.platform.configuration.dao.SiteDao;
import com.cardone.platform.configuration.dto.SiteDto;

/**
 * 站点服务
 *
 * @author yaohaitao
 * 
 */
@Getter 
@Setter
@Transactional(readOnly = true)
public class SiteDefaultService implements SiteService {
	@Override
	@Transactional
	public <P> P saveByIdOrCode(Class<P> mappedClass, SiteDto saveSite) {
		return ContextHolder.getBean(SiteDao.class).saveByIdOrCode(mappedClass, saveSite);
	}
	
	@Override
	@Transactional
	public SiteDto saveByIdOrCode(SiteDto saveSite) {
		return ContextHolder.getBean(SiteDao.class).saveByIdOrCode(SiteDto.class, saveSite);
	}
	
	@Override
	public <P> P findByCodeOrId(Class<P> mappedClass, SiteDto findSite) {
		return ContextHolder.getBean(SiteDao.class).findByCodeOrId(mappedClass, findSite);
	}
	
	@Override
	public Integer readByCodeNqIdForCount(SiteDto readSite) {
		return ContextHolder.getBean(SiteDao.class).readByCodeNqIdForCount(readSite);
	}
	
	@Override
	@Transactional
	public int insertByCode(SiteDto insertSite) {
		return ContextHolder.getBean(SiteDao.class).insertByCode(insertSite);
	}
	
	@Override
	@Transactional
	public int updateByCode(SiteDto updateSite) {
		return ContextHolder.getBean(SiteDao.class).updateByCode(updateSite);
	}

	@Override
	@Transactional
	public int deleteByIds(SiteDto deleteSite) {
		return ContextHolder.getBean(SiteDao.class).deleteByIds(deleteSite);
	}

	@Override
	public <P> P findById(Class<P> mappedClass, SiteDto findSite) {
		return ContextHolder.getBean(SiteDao.class).findById(mappedClass, findSite);
	}

	@Override
	public <P> List<P> findListByLikeCode(Class<P> mappedClass, SiteDto findListSite) {
		return ContextHolder.getBean(SiteDao.class).findListByLikeCode(mappedClass, findListSite);
	}

	@Override
	public <P> List<P> findList(Class<P> mappedClass) {
		return ContextHolder.getBean(SiteDao.class).findList(mappedClass);
	}

	@Override
	public <P> PaginationDto<P> paginationByLikeCode(Class<P> mappedClass, SiteDto paginationSite) {
		return ContextHolder.getBean(SiteDao.class).paginationByLikeCode(mappedClass, paginationSite);
	}
}